﻿using ITXHWEB.Models;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Web.Mvc;
using WPFExcelReport;
using WPFExcelReport.Helpers;
using ITXHWEB.Infrastructure;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ITXHWEB.Controllers
{
    public partial class ABFOLGEController
    {
        [ChildActionOnly]
        public ActionResult SABPTP(string returnUrl)
        {
            ModelState.Clear();
            ViewBag.ReturnUrl = returnUrl;
            if (!MABF.IsABPReady)
            {
                INFO = "请扫描有效的单号";
            }
            return PartialView(MABF);
        }
        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult SABPTP(ABFOLGEModel model, string returnUrl)
        {
            try
            {
                ModelState.Clear();
                if(model.ABPAUF.Trim().Length<15)
                {
                    return View();
                }
                MABF.ABPAUF = model.ABPAUF.Trim().Substring(0,11);
                MABF.MKFTP = model.ABPAUF.Substring(11, 4);
                ABFLOAD(model);
                INFO = "单号扫描正确";
            }
            catch (Exception ex)
            {
                INFO = ex.Message;
                Tracer.Error(ex.StackTrace, ex);
            }
            return RedirectToAction(MAPP, MAPP); 
        } 
    }
}
